package controllers

import (
	"beegoProject/models"
	"github.com/astaxie/beego"
)

type VideoController struct {
	beego.Controller
}

func (ctx *VideoController) GetVideoListByPage() {
	//get requested values
	page, _ := ctx.GetInt("page")
	pageSize, _ := ctx.GetInt("pageSize")
	//查询
	//data := models.GetVideoListByPage(page, pageSize)
	data := models.GetVideoListByPageAndGorm(page, pageSize)
	//总条数
	//count := models.GetVideoCount()
	//返回数据
	ctx.Data["json"] = map[string]interface{}{
		"data":  data,
		"count": 2121,
	}
	ctx.ServeJSON()
}
